﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web;
using common;

namespace logistical.Controllers
{
    public class serverDirsController : baseController
    {
        [HttpGet]
        public object getRootDirs()
        {
            string path = HttpContext.Current.Server.MapPath("~/");
            mapDirs o = new mapDirs(path, "~/");
            return new { msg = "seccuss", dirs = o.getDirs(), path = "~/" };
        }

        [HttpGet]
        public object getDirs(string vpath)
        {
            var _vpath = (vpath == "" || vpath == null) ? "~/" : vpath + "/";
            string path = HttpContext.Current.Server.MapPath(_vpath);
            mapDirs o = new mapDirs(path, _vpath);
            return new { msg = "seccuss", dirs = o.getDirs(), path = _vpath };
        }
    }
}
